package com.emellend.api.text;

import android.content.Context;
import android.text.Editable;
import android.text.method.MovementMethod;
import android.text.method.ScrollingMovementMethod;
import android.util.AttributeSet;
import android.widget.TextView;
/**
 * 自定义控件，默认就可以上下滚动内容
 * @author emellend
 *
 */
public class LogTextBox extends TextView {
	public LogTextBox(Context context) {
		this(context, null);
	}

	public LogTextBox(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public LogTextBox(Context context, AttributeSet attrs) {
		this(context, attrs,android.R.attr.textViewStyle);
	}
	
	@Override
	protected MovementMethod getDefaultMovementMethod() {
		return ScrollingMovementMethod.getInstance();
	}

	@Override
	public Editable getText() {
		return (Editable) super.getText();
	}
	
	@Override
	public void setText(CharSequence text, BufferType type) {
		super.setText(text, BufferType.EDITABLE);
	}
}
